#include "GenInfo.h"

#include <istream>

//-------------------------------------------------------------------------

std::istream& operator>>(std::istream& i_in, GenInfo& o_gen_config)
  {
  i_in >> o_gen_config.m_edges 
       >> o_gen_config.m_filling 
       >> o_gen_config.m_max;

  return i_in;
  }

//-------------------------------------------------------------------------

bool operator<(const GenInfo& i_gen_info1, const GenInfo& i_gen_info2)
  {
  if (i_gen_info1.m_edges < i_gen_info2.m_edges)
    return true;
  else if (i_gen_info1.m_edges == i_gen_info2.m_edges)
    {
    if (i_gen_info1.m_filling < i_gen_info2.m_filling)
      return true;
    else if (i_gen_info1.m_filling == i_gen_info2.m_filling)
      {
      if (i_gen_info1.m_max < i_gen_info2.m_max)
        return true;
      }
    }
  return false;
  }

//-------------------------------------------------------------------------

std::istream& operator>>(std::istream& i_in, GenInfoMap& o_gen_info_map)
  {
  GenInfo gen_info;
  size_t count;

  while(!i_in.eof())
    {
    i_in >> count >> gen_info;
    o_gen_info_map[gen_info] += count; 
    }

  return i_in;
  }
